﻿using CommonServiceLocator;
using Prism.Commands;
using Prism.Events;
using Prism.Mvvm;
using SPW.Infrastructure.Interfaces;
using SPW.Infrastructure.Repositorys;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Input;

namespace SPW.MainViewer.ViewModels
{
    /**
     * Command 自动路由参数
     * 默认类型为 System.Windows.RoutedEventArgs
     * e.Source 源
     */

    public class EarthViewerViewModel : BindableBase
    {
        private readonly ISGWorld _sGWorld;

        public EarthViewerViewModel(ISGWorld sGWorld)
        {
            _sGWorld = sGWorld;
        }

        public ICommand LoadedCommand
        {
            get => new DelegateCommand<AxTerraExplorerX.AxTE3DWindow>((ocx) =>
            {
                ocx.BorderStyle = 0;
                _sGWorld.Reader().OpenProject($"{System.AppDomain.CurrentDomain.BaseDirectory}\\App_Data\\Default\\default_local.FLY");
            });
        }
    }
}
